<%@ page import="com.fuful.domain.Product" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<p>
<%
    if (application.getAttribute("count") == null) {
        application.setAttribute("count", new Integer(0));
    }
    Integer count = (Integer) application.getAttribute("count");
    application
            .setAttribute("count", new Integer(count.intValue() + 1));
    count = (Integer) application.getAttribute("count");

%>

<div style="text-align: center;">
    当前在<%=count.intValue()%>页!
</div>
<form name="cx" action="cxProduct.do" method="post">
    <input type="text" id="productname" name="pname" placeholder="请输入查询产品名称">
    <input type="submit" value="查询">
</form>
</p>
<table border="1">
    <tr>
        <td>产品编码</td>
        <td>产品名称</td>
        <td>产品类型</td>
        <td>产品价格</td>
        <td>操作</td>
    </tr>
    <%
        //获取共享对象
        List<Product> data = (ArrayList) session.getAttribute("productdata");
        for (Product p : data) {
    %>
    <tr>
        <td><%= p.getPcode()%>
        </td>
        <td><%= p.getPname()%>
        </td>
        <td><a href="findPTypeProducts.do?ptid=<%= p.getPtid().getPtid()%>"><%= p.getPtid().getPtname()%>
        </a></td>
        <td><%= p.getPprice()%>
        </td>
        <td>添加</td>
    </tr>
    <%
        }
    %>
</table>
</body>
</html>
